---------------------------------------
Replication materials for: 
"The Impact of China’s AIIB on the World Bank," by Jing Qian, James Raymond Vreeland, and Jianzhi Zhao, published in International Organization.

Table of contents:
1. Overview
2. Session Info
3. Note on estimations using bpCausal or gsynth
4. Seed locations
5. Run time and storage
6. General replication directions
---------------------------------------

1. Overview

The replication materials contain four main folders:

"code": this folder contains the scripts to replicate the results. 
- The "rep_main_text.R" file replicates all the materials in the main text of the paper. 
- Codes to replicate results in the appendix are located in the "codes_appendix" folder, with the filename indicates the table or figure to replicate. 
- The "custom_functions.R" file contains user-defined functions to implement the estimations more efficiently for the appendix. 

"data": this folder contains all the datasets used to replicate the results. 
- "data_main.RData": the main dataset for the results in the main text, and for most results in the appendix. 
- "data_imputed.RData": contains five imputed dataset (by Amelia II) for replicating Figure A.2
- "data_vote.RData": dataset for U.S. votes on new WB project proposals, for replicating Table C.1
- "data_condition.RData": dataset for WB conditionality, for replicating Table C.5
- "data_condition_rep.RData": dataset of Clark and Dolan (2021), for replicating Table C.6
- "data_aiib.RData": contains data of AIIB projects, used to replicate Figure D.1

"result": this folder is used to store the result from the main results, to be used to produce several figures in the appendix. 

"figure": this folder is used to store the exported figures by replication scripts.



2. Session Info

The analysis was conducted with the specification below.

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
system code page: 65001

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] alpaca_0.3.3       gsynth_1.1.8       panelView_1.1.2    stargazer_5.2.2    MASS_7.3-51.6      sandwich_2.5-1    
 [7] lmtest_0.9-38      zoo_1.8-8          RColorBrewer_1.1-2 forcats_0.5.0      stringr_1.4.0      dplyr_1.0.2       
[13] purrr_0.3.4        readr_1.3.1        tidyr_1.1.2        tibble_3.1.3       ggplot2_3.3.2      tidyverse_1.3.0   
[19] bpCausal_0.0.1    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        mvtnorm_1.1-3     lubridate_1.7.9   lattice_0.20-41   assertthat_0.2.1  foreach_1.5.0     utf8_1.2.2       
 [8] lfe_2.8-5.1       R6_2.4.1          cellranger_1.1.0  plyr_1.8.6        backports_1.1.10  reprex_0.3.0      httr_1.4.2       
[15] pillar_1.6.2      rlang_0.4.10      readxl_1.3.1      data.table_1.13.0 rstudioapi_0.11   blob_1.2.1        Matrix_1.2-18    
[22] munsell_0.5.0     broom_0.7.0       compiler_4.0.2    modelr_0.1.8      pkgconfig_2.0.3   tidyselect_1.1.0  gridExtra_2.3    
[29] codetools_0.2-16  reshape_0.8.8     fansi_0.4.1       crayon_1.3.4      dbplyr_1.4.4      withr_2.3.0       grid_4.0.2       
[36] xtable_1.8-4      jsonlite_1.7.1    GGally_2.0.0      gtable_0.3.0      lifecycle_0.2.0   DBI_1.1.0         magrittr_1.5     
[43] scales_1.1.1      cli_2.0.2         stringi_1.5.3     fs_1.5.0          doParallel_1.0.15 xml2_1.3.2        ellipsis_0.3.2   
[50] generics_0.1.0    vctrs_0.3.8       Formula_1.2-3     iterators_1.0



3. Note on estimations using bpCausal or gsynth

If running with different version of R, or different versions of packages (including those required by bpCausal or gsynth), the results from bpCausal or gsynth might not be exactly the same as reported in the paper. This is to be expected, given how these two packages are compiled, and has been confirmed by the authors of the corresponding packages and papers. Differences are small and negligible, with no impact on the findings or conclusions in the paper.

If you encounter failures installing bpCausal or gsynth, please check https://github.com/liulch/bpCausal and https://yiqingxu.org/packages/gsynth/



4. Seed locations

- "rep_main_text.R": set.seed(1234) immediately before calling the bpCausal() function.

- All files in "codes_appendix" folder: 
  - seed.use = 1234 for gsynth() in "rep_Table_A1_part2_Figure_A1.R"
  - seed.use = 1234 as default parameter for bpcausal.group() defined in "custom_functions.R"



5. Run time and storage

- Both bpCausal() and gsynth() require a relatively long time to estimate.  The approximated run time is noted in the scripts, before the codes for each set of estimations, based on the computer specification below:
  - Operating system: Windows 10 Home
  - Processor: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz   1.99 GHz
  - Installed RAM: 16.0GB
  - System type: 64-bit operating system, x64-based processor

- To avoid estimating the original result repeatedly, the results are stored in the "result" folder, which requires around 250 MB of disk space.
  - To save disk space, other results are not stored locally. 



6. General replication directions

- To replicate the results in the main text, run the script "rep_main_text.R". Note that you need to replace the working directory with the corresponding path on your computer. 

- To replicate results in the appendix, run the corresponding script in the "codes_appendix" folder.

- All figures will be saved in the "figure" folder.

- Tables, or all the information contained in the tables, will be printed in the output. 

   - For models supported by stargazer, an organized table will be printed in the output. 

   - For models NOT supported by stargazer, all the information included in the table will be printed out separately in the output.

- Scripts for replication by Table/Figure of all empirical results:

MAIN TEXT
Figure 1: rep_main_text.R
Figure 2: rep_main_text.R
Figure 3: rep_main_text.R
Table 1: rep_main_text.R

APPENDIX
Figure A.1: rep_Table_A1_part2_Figure_A1.R
Figure A.2: rep_Figure_A2.R
Figure A.3: rep_Figure_A3.R
Figure A.4: rep_Figure_A4.R
Figure A.5: rep_Figure_A5_A6.R
Figure A.6: rep_Figure_A5_A6.R
Figure A.7: rep_Figure_A7.R
Figure A.8: rep_Figure_A8.R
Figure A.9: rep_Figure_A9.R
Figure A.10: rep_Figure_A10.R
Figure A.11: rep_Figure_A11.R

Figure B.1: rep_Figure_B1_B3.R
Figure B.2: rep_Figure_B1_B3.R
Figure B.3: rep_Figure_B1_B3.R

Figure C.1: rep_Table_C2_Figure_C1.R
Figure C.2: rep_Table_C3_Figure_C2.R
Figure C.3: rep_Figure_C3.R

Figure D.1: rep_Figure_D1.R
Figure D.2: rep_Figure_D2.R

Figure E.1: rep_Table_E2_Figure_E1.R
Figure E.2: rep_Figure_E2.R

Figure F.1: rep_Figure_F1_F2.R
Figure F.2: rep_Figure_F1_F2.R
Figure F.3: rep_Figure_F3.R

Figure G.1: rep_Figure_G1.R
Figure G.2: rep_Figure_G2.R

Table A.1: rep_Table_A1_part1.R (columns 1-4) and rep_Table_A1_part2_Figure_A1.R (column 5)

Table C.1: rep_Table_C1.R
Table C.2: rep_Table_C2_Figure_C1.R
Table C.3: rep_Table_C3_Figure_C2.R
Table C.4: rep_Table_C4.R
Table C.5: rep_Table_C5.R
Table C.6: rep_Table_C6.R
Table C.7: rep_Table_C7.R

Table E.1: rep_Table_E1.R
Table E.2: rep_Table_E2_Figure_E1.R

Table F.2: rep_Table_F2.R